package com.songjg.demo.controller;

import com.songjg.demo.entity.first.TbUser;
import com.songjg.demo.entity.second.UserPo;
import com.songjg.demo.service.UserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: song.jingen
 * @create: 2019/7/19 16:44
 **/
@RestController
public class UserController {

    @Resource
    private UserService userService;

    @ApiOperation(value="获取用户列表", notes="获取用户列表")
    @RequestMapping(value = "userList", method = RequestMethod.GET)
    public String userList(){
        List<UserPo> list = userService.userList();
        return  list.toString();
    }
    @ApiOperation(value="根据ID获取对象", notes="根据ID获取对象")
    @ApiImplicitParam(name = "id", value = "用户ID", required = true)
    @PostMapping("tbUserById/{id}")
    public TbUser tbUserById(@PathVariable Integer id){
        TbUser tbUser = userService.tbUser(id);
        return  tbUser;
    }
}
